-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(clients): generate code snippets from cts #2511
Conversation
✅ Deploy Preview for api-clients-automation ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✗ The generated branch has been deleted.If the PR has been merged, you can check the generated code on the |
d1ccc0e
to
fb026e9
Compare
a6b7144
to
74bbf79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so cool, almost nothing to add !
generators/src/main/java/com/algolia/codegen/cts/AlgoliaCTSGenerator.java
Outdated
Show resolved
Hide resolved
@@ -43,6 +43,9 @@ export async function ctsGenerateMany(generators: Generator[]): Promise<void> { | |||
await run('YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install', { | |||
cwd: 'tests/output/javascript', | |||
}); | |||
await run('YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be in a totally different file, like scripts/snippets/generate.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not yet created the CLI stuff, I know you want to do it :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's start with that !
🧭 What and Why
🎟 JIRA Ticket: https://algolia.atlassian.net/browse/DI-1749
Changes included:
This PR registers a new generator in order to generate code snippets for each method of each languages, it is completely based on the CTS request generator and will take the first test case of each method as the example.
The snippets are generated for
Generators change
I had to change the output folder and template dir in order to fully reuse the
TestsRequest
generator, which means each template has been edited to include thetests
folder when using partial templatesclients.config.json
A new field named
snippets
allows us to store the output folder and the file extension, similarly to what we do for testsCI
We now store the snippets in the artifacts and restore them in order to be pushed by the CI
What's next